Special property "Allows value"
Allows value | |
---|---|
Lists one permissible value for a property
| |
Further Information | |
Provided by: | extension "Semantic MediaWiki "Allows to store and query data annotated to pages |
Added: | 1.0 |
Removed: | still in use |
Alias: | has no alias |
Optional: | no |
Visible: | yes |
Annotable: | yes |
Declarative: | yes |
Key: | _PVAL
|
Setting: | not specified |
Focus: | property restriction |
In this wiki: | Property:Allows value |
Table of Contents | |
The Allows value property is a special property in Semantic MediaWiki with a built-in meaning: it lists one permissible value for a property.
You can use this special property with a property of any datatype to limit its possible values. It is similar in its functionality to special property "Allows pattern"Pattern to match a permissible value.
When [[Foo::bar]]
is used to set a property to a value that is not allowed, the property will not be set, and a warning sign will be shown. When using {{#set: Foo=bar }}
to set the property, the error will be silently ignored. To find all pages that use a value that is not allowed, special property "Has improper value for"Alerts in case the assigned value to a property is invalid can be used.
See the property page "Allows value" to see which pages use this special property on this wiki.
Simple[edit]
For example, the page for a "Problem severity" property might contain:
[[Allows value::Trivial]] [[Allows value::Minor]] [[Allows value::Normal]] [[Allows value::Major]] [[Allows value::Critical]]
Ordered[edit]
Enumerating several allowed values does not put the possible values of a property in that order. Properties will always sort in the natural order provided by the datatype assigned to them. You can ensure that alphabetical sort order is appropriate for properties of e.g. datatype "Text"Holds text of arbitrary length by using a prefix, for example:
[[Allows value::a - Trivial]] [[Allows value::b - Minor]] [[Allows value::c - Normal]] [[Allows value::d - Major]] [[Allows value::e - Critical]] ...
Thus you can query for greater-than-or-equal or less-than-or-equal values, for example [[property name::<c-Minor]]
Bounded intervals and ranges[edit]
Starting with Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x. bounded intervals can be specified for values to properties of datatype "Number"Holds integer and decimal numbers, with an optional exponent and datatype "Quantity"Holds values that describe quantities, containing both a number and a unit.1
A range can be defined using >
and <
:
[[Allows value::>100]]
- or in combination
[[Allows value::>100]] [[Allows value::<200]]
An interval can be defined using the bounded range ...
indicator:
[[Allows value::1...20]] [[Allows value::100...200]]
[[Allows value::1...20]]
is equivalent to [[Allows value::>0]] [[Allows value::<21]]
. Using a range with >
and <
notation more than once per property specification is not supported. Therefore the ...
notation should be used to create numeric intervals.
See also[edit]
- Help page on special property "Allows value list"Adds a reference to a list of permissible values for a property
- Help page on special property "Allows pattern"Pattern to match a permissible value
References
- ^ | Semantic MediaWiki: GitHub pull request gh:smw:3292